<template>
  <div>
    父组件<input type="text" v-model.number="num">
    <Child @sendmsg="getMsg" :num="convertNumber"/>
    <div>接受子组件传递的数据：
      <span>{{info}}</span>
    </div>
  </div>
</template>

<script>
  import Child from './Child'

  export default {
    name: "parent",
    data() {
      return {
        info: "hih",
        num:0
      }
    },
    components: {
      Child
    },
    computed:{
      convertNumber(){
        return this.num - 0
      }
    },
    methods: {
      getMsg(data) {
        this.info = data
      }
    }
  }
</script>

<style scoped>
</style>
